You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Examples of Tank Control Logic > Mixing and Reactor Tanks
Mixing and reactor tanks receive material usually from one or more supply tanks. Once it receives the material, the tank may require a mixing or other reaction time. To illustrate, suppose we have two tanks (Tank1 and Tank2) supplying ingredients to a tank called MixingTank. First, workers pump 2000 gallons of a liquid from Tank1 at 50 gallons per minute followed by the transfer of 300 pounds of dry mix from Tank2 at 20 pounds a minute (the dry mix adds .2 gallons to the level of the MixingTank for every pound transferred, equating to 4 gallons per minute). The ingredients then mix for 15 minutes before transferring to an idle storage tank. After transferring the mix, workers must clean the MixingTank for 50 minutes to prepare it for the next mixing cycle.
The control logic for the mixing tank should be a subroutine activated from the initialization logic which continues to loop throughout the simulation. The subroutine logic might appear as follows:
Mix and clean the tank
Tank_Loop //logic repeats continuously
BEGIN
Tank_Transfer (Tank1,MixingTank,2000, 50, 0, 0)
Tank_Transfer (Tank2,MixingTank, 300, 20, 4, 0)
Tank_DoOperation (MixingTank,15) //Mix time
Wait Until Tank_State [StorageTank]= Tank_Idle /* Waits for storage tank availability */
Tank_Transfer (MixingTank, StorageTank,
Tank_Level[MixingTank],40, 0, 0)
Tank_Prep (MixingTank, 50) // Clean mixing tank for 50 minutes.
END
If the ingredients feed into the mixing tank at the same time rather than sequentially, activate the Tank_Transfer subroutines for the mixing tank and monitor the Tank_Fills array to know which ingredients enter into the tank. For simultaneous fills, replace the first two transfer statements following the BEGIN statement in the previous subroutine with the following logic:
Simultaneously mix, then clean tank
Tank_Fills[MixingTank]=0
ACTIVATE Tank_Transfer(Tank1, MixingTank, 2000, 50, 0, 0)
ACTIVATE Tank_Transfer(Tank2, MixingTank, 300, 20, 4, 0)
WAIT UNTIL Tank_Fills[MixingTank]=2
...